package com.ecommerce.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

public class ParentController {
	
	//TODO: future work using Spring AOP log
//	@Autowired
//	private IExceptionLogService exceptionLogService;
	
	private ModelAndView modelAndView;
	
	@ExceptionHandler(NullPointerException.class)
	public ModelAndView handleNullPointerException(NullPointerException e) {

		// ...Oops Do something!

		// Show user the oops page
		modelAndView = new ModelAndView("404");
		modelAndView.addObject("message", "Oops NullPointerException - "
				+ System.currentTimeMillis());

		return modelAndView;
	}

	/*@ExceptionHandler(Exception.class)
	public ModelAndView handleException(Exception e) {

		// ...Oops Do something!

		// Show user the oops page
		modelAndView = new ModelAndView("404");
		modelAndView.addObject("message",
				"Oops Exception - " + System.currentTimeMillis());

		return modelAndView;
	}*/
}
